package com.bwie.system.controller;

import com.bwie.common.domain.User;
import com.bwie.common.domain.request.UserReq;
import com.bwie.common.result.Result;
import com.bwie.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @className: UserController
 * @Description: TODO
 * @version: v1.８.0
 * @author:
 * @date:
 */
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 查找用户
     * @param userReq
     * @return
     */
    @PostMapping("/findByPhoneAndPassword")
    public Result<User> findByPhoneAndPassword(@RequestBody UserReq userReq){
        User login= userService.findByPhoneAndPassword(userReq);
        return Result.success(login);
    }

    @PostMapping("/updBalanceById")
    public Result updBalanceById(@RequestBody UserReq userReq){
        userService.updBalanceById(userReq);
        return Result.success();
    }
}
